﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VINETLIFE.BL;
using VINETLIFE.DO;

namespace VINETLIFE.Module
{
    public partial class ucYourCart : System.Web.UI.UserControl
    {
        public void Page_Load(object sender, EventArgs e)
        {
            if (Session["shop"] == null)
            {
                divYourCart.Visible = false;
            }
            else
            {
                divYourCart.Visible = true;
                //
                try
                {
                    MyShopCart cart = new MyShopCart();
                    cart = (MyShopCart)Session["shop"];
                    if (cart.GetTotalProduct() <= 0)
                    {
                        divYourCart.Visible = false;
                    }
                    else
                    {
                        ltrNumber.Text = cart.GetTotalProduct().ToString() + " sản phẩm - ";
                        ltrTotal.Text = string.Format("{0:0,0}", cart.GetTotalCost());
                    }
                }
                catch { }
            }

            string url = Request.Url.AbsolutePath;
            url = url.Substring(1, url.Length - 1);
            string url1 = url.Replace(".", "/");
            string Module = url1.Substring(0, url1.IndexOf("/"));
            if (Module.ToLower().Equals("gio-hang") || Module.ToLower().Equals("thanh-toan"))
            {
                divYourCart.Visible = false;
            }
        }

        public static void LoadX() { }
    }
}